import MySQLdb


class MySpider:

    def show(self):
        self.con = MySQLdb.connect(host="127.0.0.1", port=3306, user='root', password="root",
                                   db="lvyou", charset='utf8')
        self.cursor = self.con.cursor()
        self.cursor.execute("select title, aj, score, reviews, hot, address, jieshao, kfsj, ydzc, fwss from xiecheng")
        rows = self.cursor.fetchall()
        i = 1
        for row in rows:
            print(i, row)
            print()
            i += 1
        print("Total:", len(rows))
        self.con.close()


if __name__ == '__main__':
    MySpider().show()
